﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using MusicWorks.Service.DataContracts;
using MusicWorks.Service.Contracts;

namespace MusicWorks.Service
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class SearchService : ISearchService
    {
        public SearchSuggestions GetSuggestions(string query)
        {
            //TODO: replace with your real search engine code.
            SearchSuggestions searchSuggestions = new SearchSuggestions() { Query = query, Section = new SearchSuggestionsSection() };
            
            searchSuggestions.Section.Add(new SearchSuggestion()
            {
                Description = "Result 1 Description",
                Text = "Result 1",
                Url = "http://localhost:37082/Result1.aspx"
            });
            searchSuggestions.Section.Add(new SearchSuggestion()
            {
                Description = "Result 2 Description",
                Text = "Result 2",
                Url = "http://localhost:37082/Result2.aspx"
            });
            searchSuggestions.Section.Add(new SearchSuggestion()
            {
                Description = "Result 3 Description",
                Text = "Result 3",
                Url = "http://localhost:37082/Result3.aspx"
            });
            return searchSuggestions;
        }
        
        public SearchJSONSuggestions GetJSONSuggestions(string query)
        {
            return new SearchJSONSuggestions(GetSuggestions(query));
        }

    }
}
